package net.toocruel.iqismart.entity.core;

import net.toocruel.iqismart.entity.base.BaseEntity;
import net.toocruel.iqismart.entity.constants.Action;
import net.toocruel.iqismart.entity.constants.SourceType;
import net.toocruel.iqismart.entity.rbac.User;

import javax.persistence.*;

/**
 * @Description
 * @Auther sty
 * @createTime 2018/5/8 上午11:35
 */
@Entity
public class Doing extends BaseEntity {
    private static final long serialVersionUID = -653784111545282808L;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "userId")
    private User user;
    @Enumerated(EnumType.ORDINAL)
    private Action action;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "questionId")
    private Question question;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "answerId")
    private Answer answer;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "articleId")
    private Article article;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "toQuestionId")
    private Question toQuestion;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "toAnswerId")
    private Answer toAnswer;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "toArticleId")
    private Article toArticle;


    @Enumerated(EnumType.ORDINAL)
    private SourceType toSourceType;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "toUserId")
    private User toUser;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Action getAction() {
        return action;
    }

    public void setAction(Action action) {
        this.action = action;
    }

    public Question getQuestion() {
        return question;
    }

    public void setQuestion(Question question) {
        this.question = question;
    }

    public Answer getAnswer() {
        return answer;
    }

    public void setAnswer(Answer answer) {
        this.answer = answer;
    }

    public Article getArticle() {
        return article;
    }

    public void setArticle(Article article) {
        this.article = article;
    }

    public Question getToQuestion() {
        return toQuestion;
    }

    public void setToQuestion(Question toQuestion) {
        this.toQuestion = toQuestion;
    }

    public Answer getToAnswer() {
        return toAnswer;
    }

    public void setToAnswer(Answer toAnswer) {
        this.toAnswer = toAnswer;
    }

    public Article getToArticle() {
        return toArticle;
    }

    public void setToArticle(Article toArticle) {
        this.toArticle = toArticle;
    }

    public SourceType getToSourceType() {
        return toSourceType;
    }

    public void setToSourceType(SourceType toSourceType) {
        this.toSourceType = toSourceType;
    }

    public User getToUser() {
        return toUser;
    }

    public void setToUser(User toUser) {
        this.toUser = toUser;
    }
}
